//
//  GuideViewController.m
//  Zaker
//
//  Created by lirui on 16/3/19.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "GuideViewController.h"
#import "AppDelegate.h"
#import "GuidePageVIew.h"
@interface GuideViewController ()<GuidePageDelegate>
@property(nonatomic,retain)UITabBarController *tabBarController;
@end

@implementation GuideViewController

{
    GuidePageVIew *guidePage;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [ UIColor whiteColor];
    guidePage =[[GuidePageVIew alloc] init];
    NSArray *array = @[@"11.jpg",@"22.jpg",@"33.jpg",@"44"];
    NSMutableArray *arr =[NSMutableArray arrayWithArray:array];
    [guidePage setPic:arr];
    guidePage.delegate = self;
    [self.view addSubview:guidePage];
}
- (void)GuidePageViewEndGuide
{
    // 新闻页面创建
    NewsViewController *newsVC = [[NewsViewController alloc] init];
    UINavigationController *newsNavi = [[UINavigationController alloc] initWithRootViewController:newsVC];
    newsVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"新闻" image:[UIImage imageNamed:@"xinwen"] tag:1000];
    // 视听页面创建
    SeeViewController *seeVC = [[SeeViewController alloc] init];
    UINavigationController *seeNavi = [[UINavigationController alloc] initWithRootViewController:seeVC];
    seeVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"视听" image:[UIImage imageNamed:@"shipin"] tag:1100];
    // 搞笑页面创建
    FunnyViewController *funnyVC = [[FunnyViewController alloc] init];
    UINavigationController *funnyNavi = [[UINavigationController alloc] initWithRootViewController:funnyVC];
    funnyVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"搞笑" image:[UIImage imageNamed:@"gaoxiao"] tag:1200];
    // 社区页面创建
    CommunityViewController *communityVC = [[CommunityViewController alloc] init];
    UINavigationController *communityNavi = [[UINavigationController alloc] initWithRootViewController:communityVC];
    communityVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"社区" image:[UIImage imageNamed:@"shequ"] tag:1300];
    //我的页面
    MyViewController *my = [[MyViewController alloc] init];
    UINavigationController *navi4 = [[UINavigationController alloc] initWithRootViewController:my];
    navi4.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"我的" image:[UIImage imageNamed:@"iconfont-wode"] tag:1000];
    self.tabBarController = [[UITabBarController alloc] init];
    _tabBarController.tabBar.barStyle = UIBarStyleDefault;
    _tabBarController.tabBar.tintColor = [UIColor redColor];
    // 将Controller放入tabBar中
    _tabBarController.viewControllers = @[newsNavi, seeNavi, funnyNavi, communityNavi, navi4];
    
    AppDelegate *delegate = [UIApplication sharedApplication].delegate;
    
    [UIView animateWithDuration:1 animations:^{
        guidePage.alpha = 0;
    } completion:^(BOOL finished) {
        delegate.window.rootViewController = _tabBarController;
        
        
    }];

}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
